import 'package:flutter/material.dart';
import '../../utils/navigator_utils.dart';
import 'container_5_1_padding.dart';
import 'container_5_2_size_limit.dart';
import 'container_5_3_decorated_box.dart';
import 'container_5_4_transform.dart';
import 'container_5_5_container.dart';
import 'container_5_6_scaffold.dart';
import 'container_5_7_tab_bar.dart';
import 'container_5_8_bottom_app_bar.dart';
import 'container_5_9_clip.dart';

/// 第五章：容器类widget

class FiveRoute extends StatefulWidget {
  @override
  _FiveRouteState createState() => _FiveRouteState();
}

class _FiveRouteState extends State<FiveRoute> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("第五章：容器类widget"),
      ),
      body: _FiveRouteBody(),
    );
  }
}

class _FiveRouteBody extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(left: 20.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: _getWidget(context),
      ),
    );
  }

  List<Widget> _getWidget(BuildContext context) {
    return [
      RaisedButton(
          child: Text("填充：Padding"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new PaddingRoute())),
      RaisedButton(
          child: Text("尺寸限制类容器：ConstrainedBox、SizedBox等"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new SizeLimitRoute())),
      RaisedButton(
          child: Text("装饰容器：DecoratedBox"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new DecoratedBoxRote())),
      RaisedButton(
          child: Text("变换：Transform"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new TransformRoute())),
      RaisedButton(
          child: Text("容器：Container"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new ContainerRoute())),
      RaisedButton(
          child: Text("导航栏：Scaffold"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new ScaffoldRote())),
      RaisedButton(
          child: Text("导航栏：TabBar"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new TabBarRoute())),
      RaisedButton(
          child: Text("底部导航：BottomAppBar"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new BottomAppBarRoute())),
      RaisedButton(
          child: Text("剪裁：Clip"),
          onPressed: () =>
              NavigatorUtil.goPageByPush(context, new ClipRoute())),
    ];
  }
}
